package summer.dp;

public class Solution198 {
    public int rob(int[] nums) {
        int a = 0;
        int b = 0;
        int cur;
        for (int i = 0; i < nums.length; i++) {
            cur = Math.max(b, nums[i] + a);
            a = b;
            b = cur;
        }
        return b;
    }
}
